﻿@section title
{
    找回密码
}
@section pagetitle
{
    找回密码
}@section header
{
    <link rel="stylesheet" href="~/Themes/RongJi/Style/base/css/password.css">
}
@model RiderShop.Mobile.Modle.FindPasswordModel
<div class="userCenterHeader">
    <span class="iconWrapper">
        <img src="~/Themes/RongJi/Style/base/imgs/icon_mi.png">
    </span>
    <h3>找回密码</h3>
    <br class="clearfix">
</div>


<div class="box">
    <form action="~/Customer/FindPasswordByPhone" method="post" id="passForm" class="">

        <input name="UserName" id="UserName" type="hidden" value="@Model.UserInfo.UserName" />
        <input name="ActionType" id="ActionType" type="hidden" value="@Model.ActionType" />

        <h3>请输入绑定的手机号</h3>
        <input name="CellPhone" type="text" id="CellPhone" value="@Model.CellPhone" class="form-control" placeholder="@(Model.UserInfo.CellPhone.Substring(0, 3) + "-----" + Model.UserInfo.CellPhone.Substring(Model.UserInfo.CellPhone.Length - 3, 3))">
        <div class="form-group">
            <input name="VerifyCode" type="tel" id="VerifyCode" class="form-control" placeholder="验证码">
            <input type="button" class="form-control btn-success" id="getCode" value="获取验证码">
            <br class="clearfix" />
        </div>
        <span class="err_msg">@Model.Message</span>
        <div class="mb20">
            <input id="btnSubmit" type="submit" class="btn btn-warning btn-block mt20" value="下一步" data-theme="a" data-role="button" />
        </div>
        <div class="clear"></div>
    </form>
</div>

@section footer
{
    <script type="text/javascript">
        $(function () {
            //让toolbar选中
            var $homeImg = $("#homeImg");
            var $categoryImg = $("#categoryImg");
            var $myaccountImg = $("#myaccountImg");
            var $searchImg = $("#searchImg");

            $homeImg.attr("src", "/Themes/RongJi/Style/base/imgs/f10.png");
            $categoryImg.attr("src", "/Themes/RongJi/Style/base/imgs/f2.png");
            $myaccountImg.attr("src", "/Themes/RongJi/Style/base/imgs/f3_c.png");
            $searchImg.attr("src", "/Themes/RongJi/Style/base/imgs/f4.png");



            var isCodeSended = false;
            var timeOut = 60;
            $("#getCode").click(function () {
                if (isCodeSended) {
                    return;
                }
                if (!$("#CellPhone").val()) {
                    KevinShop.MessageBox.Alert("请输入手机号!");
                    return;
                }
                isCodeSended = true;

                var postdata = "{'userName':'" + $("#UserName").val() + "','cellPhone':'" + $("#CellPhone").val() + "'}"
                KevinShop.Common.Ajax.Post("SendSMSValdateCode", postdata, function (data) {
                    if (data) {
                        isCodeSended = false;
                        KevinShop.MessageBox.Alert(data);
                    }
                    else {
                        updateTime(timeOut);
                        KevinShop.MessageBox.Alert("发送成功！");
                    }
                });
            });

            function updateTime(timeout) {
                $("#getCode").val('获取(' + timeout + ')');
                setTimeout(function () {
                    if (timeout > 0) {
                        updateTime(timeout - 1);
                    }
                    else {
                        isCodeSended = false;
                    }
                }, 1000);
            }

            $("#btnSubmit").click(function () {
                if (!$("#CellPhone").val()) {
                    KevinShop.MessageBox.Alert("请输入手机号!");
                    return false;
                }

                if (!$("#VerifyCode").val()) {
                    KevinShop.MessageBox.Alert("请输入验证码!");
                    return false;
                }


                document.forms["passForm"].submit();
            });
        });
    </script>
}